<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
	</head>
	<body>
		<div id="app">
			<h2>{{firstName + ' ' + lastName}}</h2>
			<h2>{{firstName}} {{lastName}}</h2>
			<h2>{{getFullName()}}</h2>
			<h3>{{message.split(' ').reverse().join(' ')}}</h3>
			<h3>{{reverseMessage()}}</h3>
		</div>

		<script src="./js/vue.js"></script>
		<script>
			// 1. 创建app实例
			const app = Vue.createApp({
				data() {
					return {
						firstName: 'kobe',
						lastName: 'bryant',
						message: 'my name is why',
					}
				},
				methods: {
					getFullName() {
						return this.firstName + ' ' + this.lastName
					},
					reverseMessage() {
						return this.message.split(' ').reverse().join(' ')
					},
				},
			})

			// 2. 挂载到#app上
			app.mount('#app')
		</script>
	</body>
</html>
